<template>
  <view class="page-container">
    <view class="receipt-info">
      <uni-file-picker
        limit="3"
        title="请拍照上传回单凭证"
        v-model="certificatePictureList"
      ></uni-file-picker>
      <uni-file-picker
        limit="3"
        title="请拍照上传货品照片"
        v-model="deliverPictureList"
      ></uni-file-picker>
    </view>
    <button :disabled="!isEnable" class="button">提交</button>
  </view>
</template>

<script setup>
  // 定义两个响应式变量，用来接收uni-file-picker接收到的图片数据
  import { ref, computed } from 'vue'
  import { onLoad } from '@dcloudio/uni-app'
  // 商品照片
  const deliverPictureList = ref([])
  // 凭证照片
  const certificatePictureList = ref([])
  const taskId = ref(0)

  onLoad((params) => {
    taskId.value = params.id
  })
  // 控制按钮是否可以点击
  const isEnable = computed(() => {
    return (
      deliverPictureList.value.length > 0 &&
      certificatePictureList.value.length > 0
    )
  })

  // 将表单数据提交到服务器
</script>

<style lang="scss" scoped>
  .page-container {
    padding: 30rpx;
  }

  .receipt-info {
    min-height: 600rpx;
    background-color: #fff;
    padding: 20rpx 30rpx;
    border-radius: 16rpx;

    ::v-deep .uni-file-picker {
      margin-bottom: 30rpx;
    }
  }

  .button {
    height: 100rpx;
    text-align: center;
    line-height: 100rpx;
    /* #ifdef APP */
    padding-top: 4rpx;
    /* #endif */
    border-radius: 100rpx;
    margin-top: 60rpx;
    color: #fff;
    font-size: $uni-font-size-big;
    background-color: $uni-primary;

    &[disabled] {
      color: #fff;
      background-color: #fadcd9;
    }
  }
</style>
